<template>
	<view class="container">
		<view
			style="width: 640rpx;height: 950rpx;text-align: center;border-radius: 6px;box-shadow: 2px 2px 5px #a1a1a1;border: 0.3px solid #d4c8c8;background-color: rgba(255,255,255,0.5);margin: auto;margin-top: 10%;">
			<view style="width: 580rpx;height: 100rpx;margin: auto;">
				<span
					style="font-size: 23px;color: darkgray;font-weight: 600;;line-height: 100rpx;color: black;">基本信息</span>
			</view>
			<view style="width: 580rpx;height: 100rpx;border-bottom: 0.3px solid #d4c8c8;margin: auto;">
				<span
					style="font-size: 18px;color: darkgray;font-weight: 400;;line-height: 100rpx;float: left;margin-left: 40rpx; color:dimgray;">昵称:</span>
				<input
					style="font-size: 18px;color: darkgray;font-weight: 400;line-height: 100rpx;text-align: center;width: 300rpx;height: 100rpx;"
					maxlength="30" v-model="userarchives.memberUserRealName"></input>
			</view>
			<view style="width: 580rpx;height: 100rpx;border-bottom: 0.3px solid #d4c8c8;margin: auto;">
				<span
					style="font-size: 18px;color: darkgray;font-weight: 400;;line-height: 100rpx;float: left;margin-left: 40rpx;color:dimgray;">年龄:</span>
				<input
					style="font-size: 18px;color: darkgray;font-weight: 400;line-height: 100rpx;text-align: center;width: 300rpx;height: 100rpx;"
					maxlength="2" type="number" v-model="userarchives.memberUserAge"></input>
			</view>

			<view style="width: 580rpx;height: 100rpx;border-bottom: 0.3px solid #d4c8c8;margin: auto;">
				<span
					style="font-size: 18px;color: darkgray;font-weight: 400;;line-height: 100rpx;float: left;margin-left: 40rpx; color:dimgray;">身高:</span>
				<input
					style="font-size: 18px;color: darkgray;font-weight: 400;line-height: 100rpx;text-align: center;width: 300rpx;height: 100rpx;"
					maxlength="10" v-model="userarchives.memberUserHeight"></input>
			</view>
			<view style="width: 580rpx;height: 100rpx;border-bottom: 0.3px solid #d4c8c8;margin: auto;">
				<span
					style="font-size: 18px;color: darkgray;font-weight: 400;;line-height: 100rpx;float: left;margin-left: 40rpx; color:dimgray;">体重:</span>
				<input
					style="font-size: 18px;color: darkgray;font-weight: 400;line-height: 100rpx;text-align: center;width: 300rpx;height: 100rpx;"
					maxlength="10" v-model="userarchives.memberUserWeight"></input>
			</view>
			<view style="width: 580rpx;height: 100rpx;border-bottom: 0.3px solid #d4c8c8;margin: auto;">
				<span
					style="font-size: 18px;color: darkgray;font-weight: 400;;line-height: 100rpx;float: left;margin-left: 40rpx; color:dimgray;">体脂率:</span>
				<input
					style="font-size: 18px;color: darkgray;font-weight: 400;line-height: 100rpx;text-align: center;width: 300rpx;height: 100rpx;"
					maxlength="10" v-model="userarchives.memberUserBodyFat"></input>
			</view>
			<view style="width: 580rpx;height: 100rpx;border-bottom: 0.3px solid #d4c8c8;margin: auto;">
				<span
					style="font-size: 18px;color: darkgray;font-weight: 400;;line-height: 100rpx;float: left;margin-left: 40rpx; color:dimgray;">邀请码:</span>
				<input
					style="font-size: 18px;color: darkgray;font-weight: 400;line-height: 100rpx;text-align: center;width: 400rpx;height: 100rpx;"
					maxlength="100" v-model="userarchives.invitationCode"></input>
			</view>
			<view style="width: 580rpx;height: 100rpx;border-bottom: 0.3px solid #d4c8c8;margin: auto;">
				<span
					style="font-size: 18px;color: darkgray;font-weight: 400;;line-height: 100rpx;float: left;margin-left: 40rpx; color:dimgray;">手机号:</span>
				<input
					style="font-size: 18px;color: darkgray;font-weight: 400;line-height: 100rpx;text-align: center;width: 300rpx;height: 100rpx;"
					maxlength="11" v-model="userarchives.memberUserPhone"></input>
			</view>
		</view>
		<view
			style="width: 640rpx;height: 260rpx;border-radius: 6px;margin-top: 20rpx;margin-left: 270rpx; text-align: center; "
			@click="goarchiveseUpdate1()">
			<view style="width: 200rpx; ">
				<u-button type="primary" text="确定修改"></u-button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {

		data() {
			return {
				userInfo: {},
				memberUserInfo: {},
				userarchives: {
					id: '',
					memberUserName: '',
					memberUserAge: '',
					memberUserHeight: '',
					memberUserWeight: '',
					memberUserBodyFat: '',
					invitationCode: '',
					maskPhone: '',
				},
				list: [{
						name: '男',
						disabled: false
					},
					{
						name: '女',
						disabled: false
					}
				],
			}
		},
		onLoad() {
			if (uni.getStorageSync('userInfo')) {
				this.userInfo = uni.getStorageSync('userInfo')
			}
			this.getUserInformation()
			this.getUserArchives()
		},
		methods: {
			//查询用户数据
			getUserInformation() {
				uni.request({
					url: 'http://127.0.0.1:17000/studentTraining/getUserInformation',
					data: {
						id: this.userInfo.id,
						venueUniqueIdentifier: this.userInfo.venueUniqueIdentifier
					},
					success: (res) => {
						this.memberUserInfo = res.data.data.data
						// console.log(this.memberUserInfo)
					},
				})
			},
			//查询用户个人档案
			getUserArchives() {
				uni.request({
					url: 'http://127.0.0.1:17000/Archives/selectArchives',
					data: {
						id: this.userInfo.id,
					},
					success: (res) => {
						this.userarchives = res.data.data.data
						console.log(this.userarchives)
					},
				})
			},
			getUserArchives() {
				uni.request({
					url: 'http://127.0.0.1:17000/Archives/selectArticle',
					data: {
						id: this.userInfo.id,
					},
					success: (res) => {
						this.userarchives = res.data.data.data
						console.log(this.userarchives)
					},
				})
			},
			goarchiveseUpdate1() {
				console.log(this.userarchives)
				uni.request({
					url: 'http://127.0.0.1:17000/Archives/updateArchives',
					method: 'POST',
					data: {
						id:this.userarchives.id,
						memberUserAge:this.userarchives.memberUserAge,
						memberUserRealName:this.userarchives.memberUserRealName,
						memberUserHeight:this.userarchives.memberUserHeight,
						memberUserWeight:this.userarchives.memberUserWeight,
						invitationCode:this.userarchives.invitationCode,
						memberUserPhone:this.userarchives.memberUserPhone
					},
					success: (resp) => {
						uni.navigateTo({
						  url: '/pages/student/index/Archives'
						})
					}
				})
			}


			/* // 选中某个单选框时，由radio时触发
			radioChange(e) {
				// console.log(e);
			},
			// 选中任一radio时，由radio-group触发
			radioGroupChange(e) {
				// console.log(e);
			} */
		}
	}
</script>

<style>
	/* 设置背景图片 */
	.container {
		width: 100%;
		height: 100vh;
		/* display: flex; */
		justify-content: center;
		align-items: center;
		background-image: url('http://101.43.223.224:8765/image/getImageById?id=6755');
		background-size: cover;
		overflow: auto;
		/* 使背景图片覆盖整个页面 */
		/* background-repeat:repeat-y; /* 根据y轴重复显示背景图片 */
	}

	.modal-container {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background-color: rgba(0, 0, 0, 0.5);
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.modal-content {
		background-color: #fff;
		padding: 20px;
	}

	.content {
		margin-bottom: 10px;
	}
</style>